import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'
import type { RootState, AppDispatch } from './store'

// useAppDispatch返回值就是useDispatch的返回值,只是又套了一层,让我们可以不用自己亲自将AppDispatch传入到泛型中
export const useAppDispatch = () => useDispatch<AppDispatch>()
// useAppSelector 指向的就是useSelector,只是额外的声明了一下useSelector的回到中接收到的数据的类型,.就不需要自己再声明state的类型了
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector
